package com.irdstudio.bsp.console.api.rest;

import java.util.List;

import com.irdstudio.bsp.console.service.vo.BpmLinkedInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.irdstudio.bsp.console.service.facade.BpmLinkedInfoService;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.ssm.web.AbstractController;

@RestController
@RequestMapping("/api")
public class BpmLinkedInfoController extends AbstractController  {
	
	@Autowired
	@Qualifier("bpmLinkedInfoServiceImpl")
	private BpmLinkedInfoService bpmLinkedInfoService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/bpm/linked/infos", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<BpmLinkedInfoVO>> queryBpmLinkedInfoAll(
			BpmLinkedInfoVO vo) {		
		List<BpmLinkedInfoVO> outputVo = bpmLinkedInfoService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/bpm/linked/info/{linkedId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<BpmLinkedInfoVO> queryByPk(@PathVariable("linkedId") String linkedId) {		
		BpmLinkedInfoVO inVo = new BpmLinkedInfoVO();
				inVo.setLinkedId(linkedId);
		BpmLinkedInfoVO outputVo = bpmLinkedInfoService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param bpmLinkedInfo
	 * @return
	 */
	@RequestMapping(value="/bpm/linked/info", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody BpmLinkedInfoVO inBpmLinkedInfoVo) {		
		int outputVo = bpmLinkedInfoService.deleteByPk(inBpmLinkedInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inBpmLinkedInfoVo
	 * @return
	 */
	@RequestMapping(value="/bpm/linked/info", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody BpmLinkedInfoVO inBpmLinkedInfoVo) {		
		int outputVo = bpmLinkedInfoService.updateByPk(inBpmLinkedInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inBpmLinkedInfoVo
	 * @return
	 */
	@RequestMapping(value="/bpm/linked/info", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertBpmLinkedInfo(@RequestBody BpmLinkedInfoVO inBpmLinkedInfoVo) {
		int outputVo = bpmLinkedInfoService.insertBpmLinkedInfo(inBpmLinkedInfoVo);
		return getResponseData(outputVo);
		
	}
}
